# -*- coding: utf-8 -*-
# created on 2016/11/30
# 

from mathsolver.functions.base import *
from mathsolver.functions.base.base import new_latex
from sympy import sin, cos
from sympy.abc import alpha


class FSArgInit(BaseFunction):
    """
    设复数z的幅角的主值为\\frac{{2π}}{3},虚部为\\sqrt{3},则z^{2}= ( )
    """
    def solver(self, *args):
        target = args[0].sympify()
        angle = args[1].sympify()
        target_init = alpha * cos(angle) + alpha * sin(angle) * sympify('I')
        target_init = target_init.expand().simplify()
        self.steps.append(["", "设%s = %s, 得" % (new_latex(target), new_latex(target_init))])
        self.output.append(BaseComplexValue({target: target_init}))
        return self
